package com.lsmo.android.util;

 

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
 
 
/***
 * 
*
* @类描述：   Dialog相关工具类                                                  
* @项目名称：carfans     
* @类名称：DialogUtil                    
* @修改时间：2012-3-26 上午10:44:34    
* @修改备注：                                                              
*
 */
public class DialogUtil {
 
 
	/****
	 * 进度条提示框
	 * @param context
	 * @param isCancelAble
	 * @param title
	 * @param message
	 * @return
	 */
	public static ProgressDialog getProgressDialog(Context context,
			boolean isCancelAble,
			  String title,String message){
 
		
		ProgressDialog mProgDialog = new ProgressDialog(context);
		
		if(!"".equals(title))
		mProgDialog.setTitle(title);
		
		mProgDialog.setMessage(message);
		mProgDialog.setIndeterminate(true); //不确定进度范围
		mProgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
		mProgDialog.setCancelable(isCancelAble);
	 
		
		return  mProgDialog;

	}
	

	 
	
	
	/***
	 * 提示框
	 * @param context
	 * @param title
	 * @param message
	 * @param cancelable
	 * @param positiveEvent
	 * @param negativeEvent
	 * @return
	 */
	public static AlertDialog showConfirmDialog(final Context context,
			String title,
			String message,
			boolean cancelable ,
			DialogInterface.OnClickListener positiveEvent,
			DialogInterface.OnClickListener negativeEvent
	      ){
 
		 AlertDialog.Builder mAlertDialog = new AlertDialog.Builder(context);  
		mAlertDialog.setTitle(title);  
		mAlertDialog.setMessage(message);
		if(positiveEvent!=null){
			mAlertDialog.setPositiveButton("确定", positiveEvent); 
		}
		
		if(negativeEvent!=null){
			mAlertDialog.setNegativeButton("取消",  negativeEvent );  
		}
		if(!cancelable) mAlertDialog.setCancelable(false) ;
		   
		return mAlertDialog.show() ; 

	}
	
	

	
	
	
	 
	 
	
 
}
